package com.itany.boot.entity;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author shixiaojun@itany
 */
@Component
// 在读取配置文件的时候,读取指定前缀的配置
// 将该前缀所配置的所有属性与当前对象的所有属性一一映射
// 将同名的配置进行映射
@ConfigurationProperties(prefix = "user")
public class User {

//    @Value("1")
//    private Integer id;
//    @Value("admin")
//    private String username;
//    @Value("123456")
//    private String password;
//    @Value("1381234567")
//    private String phone;
//    @Value("江苏-南京")
//    private String address;

//    @Value("${user.id}")
//    private Integer id;
//    @Value("${user.username}")
//    private String username;
//    @Value("${user.password}")
//    private String password;
//    @Value("${user.phone}")
//    private String phone;
//    @Value("${user.address}")
//    private String address;

    private Integer id;
    private String username;
    private String password;
    private String phone;
    private String address;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", phone='" + phone + '\'' +
                ", address='" + address + '\'' +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
